package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IPublicationCompletionForTeamView;
import com.cloudsigns.factorymanager2.engineering.model.IPublicationCompletionForTeamModel;
import com.cloudsigns.factorymanager2.engineering.model.PublicationCompletionForTeamModel;

/**
 * Created by tony on 2018/6/18.
 */

public class PublicationCompletionForTeamPresenter {
    private IPublicationCompletionForTeamView view;
    private IPublicationCompletionForTeamModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public PublicationCompletionForTeamPresenter(IPublicationCompletionForTeamView view) {
        this.view = view;
        this.model = new PublicationCompletionForTeamModel();
    }

    public void publicationCommentFormanager() {


        model.publicationCompletionForTeam(view.getOrderId(),new PublicationCompletionForTeamModel.OnPublicationCompletionForTeamListener() {
            @Override
            public void publicationCompletionForTeamSunccessed() {
                //需要在UI线程执行
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.publicationCompletionForTeamSuccess();
                        view.hideLoading();
                    }
                });
            }

            @Override
            public void publicationCompletionForTeamFailed(final String desc) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.publicationCompletionForTeamFailed(desc);
                        view.hideLoading();
                    }
                });
            }


        });
    }
}
